package com.azzcs.provider.service.impl;

import com.azzcs.provider.service.IProviderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * @Author: wzg
 * @Date: 2021/2/6 上午10:02
 */
@Slf4j
@DubboService
public class ProviderServiceImpl implements IProviderService {
    @Override
    public String methodA() {
        try {
            Random random = new Random();
            int time = random.nextInt(100);
            TimeUnit.MILLISECONDS.sleep(time);
            log.info("methodA，执行时间"+time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodA";
    }

    @Override
    public String methodB() {
        try {
            Random random = new Random();
            int time = random.nextInt(100);
            TimeUnit.MILLISECONDS.sleep(time);
            log.info("methodB，执行时间"+time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodB";
    }

    @Override
    public String methodC() {
        try {
            Random random = new Random();
            int time = random.nextInt(100);
            TimeUnit.MILLISECONDS.sleep(time);
            log.info("methodC，执行时间"+time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodC";
    }
}
